class Solution {
    public long countCompleteDayPairs(int[] hours) {
        long ans = 0;
        int mod = 24;
        Map<Integer, Integer> cnt = new HashMap<>();
        for (int h : hours) {
            ans += cnt.getOrDefault(((mod - h % mod) % mod), 0);
            cnt.put(h % mod, cnt.getOrDefault(h % mod, 0) + 1);
        }
        return ans;
    }
}